package cz.muni.fi.PA165.musiclibraryweb.signin;

/**
 *
 * @author kubi
 */
import org.apache.wicket.Session;
import org.apache.wicket.authroles.authorization.strategies.role.IRoleCheckingStrategy;
import org.apache.wicket.authroles.authorization.strategies.role.Roles;


/**
 * The authorizer we need to provide to the authorization strategy implementation
 * {@link org.apache.wicket.authorization.strategies.role.annotations.AnnotationsRoleAuthorizationStrategy}
 * .
 * 
 */
public class UserRolesAuthorizer implements IRoleCheckingStrategy
{

    /**
     * Construct.
     */
    public UserRolesAuthorizer()
    {
    }

    /**
     * @see org.apache.wicket.authorization.strategies.role.IRoleCheckingStrategy#hasAnyRole(Roles)
     */
    @Override
    public boolean hasAnyRole(Roles roles)
    {
        SignInSession authSession = (SignInSession)Session.get();
        return authSession.getRoles().hasAnyRole(roles);
    }

}